package com.pureut.order.dubbo;

import com.pureut.order.service.SalesOrderService;
import com.sale.order.api.RemoteSaleService;
import com.sale.order.api.dto.SaleServiceDto;
import com.sale.order.api.vo.BackDataVo;
import com.sale.order.api.vo.SaleServiceVo;
import lombok.RequiredArgsConstructor;
import org.apache.dubbo.config.annotation.DubboReference;
import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.Map;

/**
 * 销售订单服务
 *
 * @Description
 * @Author Try
 * @Date 2023/8/10 16:18
 **/
@DubboService
@RequiredArgsConstructor
@Service
public class RemoteSaleServiceImpl implements RemoteSaleService {

    private final SalesOrderService salesOrderService;

    /**
     * 获取销售单价
     * @param saleServiceVo
     * @return
     */
    @Override
    public SaleServiceDto getSalePlace(SaleServiceVo saleServiceVo) {
        return salesOrderService.getSalePlace(saleServiceVo);
    }

    /**
     * 销售发货回传销售订单发货重量
     * @param backDataVo
     * @return
     */
    @Override
    public boolean updateShippingWeight(BackDataVo backDataVo) {
        com.pureut.order.vo.BackDataVo backDataVo1 = new com.pureut.order.vo.BackDataVo();
        BeanUtils.copyProperties(backDataVo,backDataVo1);
        return salesOrderService.updateShippingWeight(backDataVo1);
    }

    /**
     * 销售发货回传销售订单发货重量(扣除)
     * @param backDataVo
     * @return
     */
    @Override
    public boolean updateShippingWeightSub(BackDataVo backDataVo) {
        com.pureut.order.vo.BackDataVo backDataVo1 = new com.pureut.order.vo.BackDataVo();
        BeanUtils.copyProperties(backDataVo,backDataVo1);
        return salesOrderService.updateShippingWeightSub(backDataVo1);
    }

    /**
     * 获取销售订单明细中最新的信息集合
     */
    @Override
    public Map<String, Date> getNewSaleMap() {
        return salesOrderService.getNewSaleMap();
    }
}
